package com.markul.android.ui.signin

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.view.MotionEvent
import com.markul.android.R
import com.markul.android.ui.UiTool

class SplashActivity : AppCompatActivity() {
    private var nHandler = Handler()
    var handler=Handler()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_loading)
        UiTool.hideStatusNavigationBar(this, true)

        nHandler.postDelayed({
            val intent = Intent(this@SplashActivity, SigninActivity::class.java)
            startActivity(intent)
            finish()
        }, 2000)
    }

    override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
        when (ev.getAction()) {
            MotionEvent.ACTION_UP ->
                //设置延时让画面先加载好
                handler.postDelayed(
                    Runnable {
                        UiTool.hideStatusNavigationBar(this, true)
                    }, 3000
                )
        }
        return super.dispatchTouchEvent(ev)}
    }